package de.augsburg.chris.hausino.beans;

import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.inject.Inject;

import de.augsburg.chris.hausino.dao.PersonDAO;
import de.augsburg.chris.hausino.entity.Person;


@ManagedBean
@SessionScoped
public class PersonBean {
	
	@Inject
	private PersonDAO personDAO;
	
	private Person person;
	
	public Person getPerson() {
		if (person == null) {
			person = new Person();
		}
		return person;
	}
	
	public List<Person> getPersons(){
		return personDAO.getAll();
	}
	
	public String save() {
		personDAO.persist(person);
		return "confirmation";
	}
	


}
